package edu.sdufe.set.treeSet;

import java.util.TreeSet;

/**
 * @author wang'ji'cheng
 * @date 2025/6/29
 */
public class Demo1 {
    public static void main(String[] args) {
        TreeSet<Student> sTs = new TreeSet<Student>();
        Student s1 = new Student("张三",23);
        Student s2 = new Student("李四",24);
        Student s3 = new Student("王五",25);
        Student s4 = new Student("赵六",23);

        //向集合中添加元素
        sTs.add(s1);
        sTs.add(s2);
        sTs.add(s3);
        sTs.add(s4);

        for (Student s : sTs) {
            System.out.println(s);
        }

    }
}
